//
//  KDCollectRequestTool.m
//  WangJingApp
//
//  Created by 魏强 on 17/10/9.
//  Copyright © 2017年 KDTech. All rights reserved.
//

#import "KDCollectRequestTool.h"
#import "KDBaseTool.h"
#import "KDFavorTypeListResult.h"
#import "KDDeleteNewsParam.h"
#import "KDGetFavorListParam.h"
#import "KDMoveFavorParam.h"
@implementation KDCollectRequestTool

/**  添加收藏的请求 */
+ (void)addFavorMsgWithParam:(KDFavorParam *)param success:(void (^)(KDBaseResult *responseObejct))success failure:(void(^)(NSError *error))failure{
    NSString *url = [NSString stringWithFormat:@"%@%@",ServerActionAddr,@"collection/info/add"];
    NSDictionary *params = [param keyValues];
    [KDBaseTool post:url bodyJson:params resultClass:[KDBaseResult class] success:success failure:failure];
}
/**  取消收藏的请求 */
+ (void)cancelFavorMsgWithParam:(KDFavorParam *)param success:(void (^)(KDBaseResult *responseObejct))success failure:(void(^)(NSError *error))failure{
    NSString *url = [NSString stringWithFormat:@"%@%@",ServerActionAddr,@"collection/info/delete"];
//    NSDictionary *params = [param keyValues];
    [KDBaseTool get:url param:param resultClass:[KDBaseResult class] success:success failure:failure];
}

/**  获取收藏夹列表的请求 */
+ (void)getFavorTypeListWithParam:(KDDeleteNewsParam *)param success:(void (^)(KDFavorTypeListResult *responseObejct))success failure:(void(^)(NSError *error))failure{
    param.method = @"collection/type/myCollectionType";
    NSString *url = [NSString stringWithFormat:@"%@%@",ServerActionAddr,param.method];
    [KDBaseTool get:url param:param resultClass:[KDFavorTypeListResult class] success:success failure:failure];
}

+ (void)addFavorTypeWithParam:(id)param success:(void (^)(KDBaseResult *responseObejct))success failure:(void(^)(NSError *error))failure{
    NSString *url = [NSString stringWithFormat:@"%@%@",ServerActionAddr,@"collection/type/add"];
    [KDBaseTool post:url bodyJson:param resultClass:[KDBaseResult class] success:success failure:failure];
}

+ (void)deleteFavorTypeWithParam:(id)param success:(void (^)(KDBaseResult *responseObejct))success failure:(void(^)(NSError *error))failure{
    NSString *url = [NSString stringWithFormat:@"%@%@",ServerActionAddr,@"collection/type/delete"];
    [KDBaseTool post:url bodyJson:param resultClass:[KDBaseResult class] success:success failure:failure];
}

+ (void)deleteNewsWithParam:(KDDeleteNewsParam *)param success:(void (^)(KDBaseResult *responseObejct))success failure:(void(^)(NSError *error))failure{
    NSString *url = [NSString stringWithFormat:@"%@%@",ServerActionAddr,param.method];
    [KDBaseTool get:url param:param resultClass:[KDBaseResult class] success:success failure:failure];
}

/**   获取对应收藏夹内的收藏列表的请求 */
+ (void)getFavorListWithParam:(KDGetFavorListParam *)param success:(void (^)(KDBaseResult *responseObejct))success failure:(void(^)(NSError *error))failure{
    param.method = @"collection/info/list";
    NSString *url = [NSString stringWithFormat:@"%@%@",ServerActionAddr,param.method];
    [KDBaseTool get:url param:param resultClass:[KDBaseResult class] success:success failure:failure];

}


+ (void)moveFavorWithParam:(KDMoveFavorParam *)param success:(void (^)(KDBaseResult *responseObejct))success failure:(void(^)(NSError *error))failure{
    param.method = @"collection/info/move";
    NSString *url = [NSString stringWithFormat:@"%@%@",ServerActionAddr,param.method];
    [KDBaseTool get:url param:param resultClass:[KDBaseResult class] success:success failure:failure];

}

+ (void)getNewsWithParam:(KDMoveFavorParam *)param success:(void (^)(KDBaseResult *responseObejct))success failure:(void(^)(NSError *error))failure{
    param.method = @"news/getNews";
    NSString *url = [NSString stringWithFormat:@"%@%@",ServerActionAddr,param.method];
    [KDBaseTool get:url param:param resultClass:[KDBaseResult class] success:success failure:failure];

}
@end
